//
//  TSFilterItemCollectionViewCell.swift
//  TSProfitProject
//
//  Created by TmmmS on 2019/11/23.
//  Copyright © 2019 TMS. All rights reserved.
//

import UIKit

struct TSFilterItemModel {
    var title : String!
    var status : UInt = 0
}

class TSFilterItemCollectionViewCell: UICollectionViewCell {
    
    private var titleLabel : UILabel!
    private var model : TSFilterItemModel!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        titleLabel = UILabel.init()
        titleLabel.textColor = WHITE_COLOR
        titleLabel.backgroundColor = UIColor.hexadecimalColor(hexadecimal: "#AAAAAA")
        titleLabel.font = UIFont.systemFont(ofSize: 12)
        titleLabel.textAlignment = .center
        titleLabel.adjustsFontSizeToFitWidth = true
        titleLabel.minimumScaleFactor = 0.6
        titleLabel.layer.cornerRadius = 11
        titleLabel.layer.masksToBounds = true
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
    }
    
    func setupCell(model:TSFilterItemModel, isSelected:Bool) {
        self.model = model
        titleLabel.text = model.title
        if isSelected {
            titleLabel.backgroundColor = BASE_PURPLE_COLOR
        } else {
            titleLabel.backgroundColor = UIColor.hexadecimalColor(hexadecimal: "#AAAAAA")
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
